package com.situ.student.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.situ.student.dao.IKechengDao;
import com.situ.student.dao.impl.KechengDaoImpl;
import com.situ.student.entity.Kecheng;
import com.situ.student.service.IKechengServlet;

public class KechengServletImpl implements IKechengServlet {
	private IKechengDao kechengdao=new KechengDaoImpl();
	
	@Override
	public List<Kecheng> list() {
		//拿到数据库中查询的数据
		List<Kecheng> list=kechengdao.list();
		//新建一个集合
		List<Kecheng> list2=new ArrayList<>();
		for (Kecheng kecheng : list2) {
			list2.add(kecheng);
		}
		
		return kechengdao.list();
	}

	@Override
	public boolean deleteById(Integer id) {
		int count=kechengdao.deleteById(id);
		return count==1?true:false;
	}

	@Override
	public Kecheng findById(Integer id) {
		
		return kechengdao.findById(id);
	}

	@Override
	public boolean update(Kecheng kecheng) {
		int count=kechengdao.update(kecheng);
		return count==1?true:false;
	}

	@Override
	public boolean insert(Kecheng kecheng) {
		int count=kechengdao.insert(kecheng);
		return count ==1 ? true:false;
	}

}
